<!DOCTYPE html>
<html>
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <title>Map类</title>
     <link rel="stylesheet" type="text/css" href="http://localhost:8080/testA/arcgisjs/js/dojo/dijit/themes/tundra/tundra.css"/>
   <script type="text/javascript" src="http://localhost:8080/testA/arcgisjs/init.js"></script>
     <link rel="stylesheet" type="text/css" href="http://localhost:8080/testA/arcgisjs/js/esri/css/esri.css" />
</head>
 <script type="text/javascript">
  dojo.require('esri.map');
  dojo.require('esri.geometry.Extent');
  dojo.require('test/MeasureLength');
  // dojo.require('MeasureLength'); http://localhost:8080/testA/arcgisjs/js/dojo/MeasureLength.js
  var myMap ;
  
  function init(){
	  //var url ="http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer";
	  	var url ="http://map.geoq.cn/ArcGIS/rest/services/SimpleFeature/ChinaBoundaryLine/MapServer"; 
	  var initialExtent = new esri.geometry.Extent({
		   "xmin":6971056.979606233,
           "xmax":16363639.015286192,
           "ymin":1932328.0750486827,
           "ymax":7152059.8625854105,
           "spatialReference":
           {"wkid":102100}
		  });
		  myMap = new esri.Map('arcgisDiv',{ 
			  //center : [-98, 40] , 不能与extent同时存在
		  extent:initialExtent
			  });

     // var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer");
      var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer(url);
      myMap.addLayer(myTiledMapServiceLayer);
	   // myMap.setZoom(12);

	 myMap.setExtent(extent1);//设置显示的位置
	   var resizeTimer;
       dojo.connect(myMap, 'onLoad', function(theMap) {
         dojo.connect(dijit.byId('arcgisDiv'), 'resize', function() {
           clearTimeout(resizeTimer);
           resizeTimer = setTimeout(function() {
        	   myMap.resize();
        	   myMap.reposition();
            }, 500);
          });
        });
	   
  }

  
  dojo.addOnLoad(init);
  
  dojo.connect(dojo.byId('test'), "onclick", measure);
  dojo.connect(dojo.byId('arcgisDiv'), "click", zoomfuwei);
  function zoomfuwei(){
	  //alert(9090)
	 // myMap.responsition();
	  // myMap.setVisibility(false);
  }
  function measure(){
	   var t1 = new MeasureLength();
	 // dojo.byId('arcgisDiv').setMapCursor("url(gistech/widgets/ManageTools/images/cursor_linemeasure.cur),auto");
	t1.action(dojo.byId('arcgisDiv'));
  }
      </script>
      <body class="tundra">
       <div id="arcgisDiv" style="width:900px; height:600px; border:1px solid #000;"></div>
       <button id="test">测试复位</button>
      </body>
  </html>